package org.lanqiao.tjut.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.lanqiao.tjut.bean.UserInfoBean;
import org.lanqiao.tjut.dao.IUserInfoBeanDao;
import org.lanqiao.tjut.service.IUserInfoService;
import org.springframework.stereotype.Service;

@Service("userS")
public class IUserInfoServiceImpl implements IUserInfoService {
	@Resource
	private IUserInfoBeanDao userDao;

	@Override
	public List<UserInfoBean> findUserByNameAndPwd(UserInfoBean userB) {
		List<UserInfoBean> lstUserS = null;
		lstUserS = userDao.findUserByNameAndPwd(userB);
		// TODO Auto-generated method stub
		return lstUserS;
	}

	@Override
	public List<UserInfoBean> selectUserInfoByParams(UserInfoBean userB) {
		List<UserInfoBean> lstUserS = null;
		lstUserS = userDao.selectUserInfoByParams(userB);
		return lstUserS;
	}

	@Override
	public int deleteByPrimaryKey(String userId) {
		// TODO Auto-generated method stub
		int i = 0;
		i = userDao.deleteByPrimaryKey(userId);
		return i;
	}

	@Override
	public int saveOrUpdate(UserInfoBean userB) {
		int i = 0;
		if (userB != null && userB.getUserId() == null) {
			i = userDao.insert(userB);
		} else {
			i = userDao.updateByPrimaryKeySelective(userB);
		}
		return i;
	}

	@Override
	public int insertSelective(UserInfoBean userB) {
		int i = 0;
		i = userDao.insertSelective(userB);
		return i;
	}

	@Override
	public UserInfoBean selectByPrimaryKey(Short userId) {
		UserInfoBean lstUser = null;
		lstUser = userDao.selectByPrimaryKey(userId);
		return lstUser;
	}

}
